package day10;

import java.util.Scanner;

public class Ques1231 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		while(n-- > 0){
			int sum = 1;
			boolean flag = true;
			int index = scan.nextInt();
			int x = scan.nextInt();
			for(int i = 1;i < index;i ++){
				int y = scan.nextInt();
				if(flag){
					if(y < x){
						sum ++;
						flag = false;
						x = y;
					}
				}else{
					if(y > x){
						sum ++;
						flag = true;
						x = y;
					}
				}
			}
			System.out.println(sum);
		}
	}
}
